﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Catering.Catering_Page.richang
{
    public partial class YuanLiaoYanShou : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        #region 原料验收
        /// <summary>
        /// 获取单个
        /// 编写：章建国
        /// </summary>
        /// <param name="_rbid"></param>
        /// <returns></returns>
        [System.Web.Services.WebMethod]
        public static System.Collections.ArrayList Get(string _rbid)
        {
            System.Collections.ArrayList al = new System.Collections.ArrayList();
            Catering_Model.YuanLiaoYanShou _model = new Catering_Model.YuanLiaoYanShou();
            Catering_Rules.YuanLiaoYanShou _rules = new Catering_Rules.YuanLiaoYanShou();
            try
            {
                var list = _rules.GetModelList(" ribaobianhao = '" + _rbid + "'");
                if (list != null && list.Count > 0)
                {
                    _model = list.First();
                    al.Add(_model.hege);
                    al.Add(_model.lingdao);
                    al.Add(_model.shangcai);
                    al.Add(_model.yanshou);
                }
            }
            catch
            {
            }
            return al;
        }

        /// <summary>
        /// 编写：章建国
        /// </summary>
        /// <returns></returns>
        [System.Web.Services.WebMethod]
        public static string YLYS(string isYuanLiaoYanShou, string ribaobianhao)
        {
            string mes = "error";
            Catering_Model.YuanLiaoYanShou _model = new Catering_Model.YuanLiaoYanShou();
            Catering_Rules.YuanLiaoYanShou _rules = new Catering_Rules.YuanLiaoYanShou();
            try
            {
                var list = _rules.GetModelList(" ribaobianhao = '" + ribaobianhao + "'");
                if (list != null && list.Count > 0)
                {
                    _model = list.First();
                    _model.yanshou = Convert.ToBoolean(isYuanLiaoYanShou);
                    _model.ribaobianhao = ribaobianhao;
                    if (_rules.Update(_model))
                    {
                        return mes = "ok";
                    }
                }
            }
            catch
            {
            }
            _model.yanshou = Convert.ToBoolean(isYuanLiaoYanShou);
            _model.ribaobianhao = ribaobianhao;
            if (_rules.Add(_model) > 0)
            {
                mes = "ok";
            }
            return mes;
        }

        /// <summary>
        /// 编写：章建国
        /// </summary>
        /// <returns></returns>
        [System.Web.Services.WebMethod]
        public static string sssc(string shangcai, string ribaobianhao)
        {
            string mes = "error";
            Catering_Model.YuanLiaoYanShou _model = new Catering_Model.YuanLiaoYanShou();
            Catering_Rules.YuanLiaoYanShou _rules = new Catering_Rules.YuanLiaoYanShou();
            try
            {
                var list = _rules.GetModelList(" ribaobianhao = '" + ribaobianhao + "'");
                if (list != null && list.Count > 0)
                {
                    _model = list.First();
                    _model.shangcai = Convert.ToBoolean(shangcai);
                    if (_rules.Update(_model))
                    {
                        return mes = "ok";
                    }
                }
            }
            catch
            {
            }
            return mes;
        }

        /// <summary>
        /// 编写：章建国
        /// </summary>
        /// <returns></returns>
        [System.Web.Services.WebMethod]
        public static string hg(string hege, string ribaobianhao)
        {
            string mes = "error";
            Catering_Model.YuanLiaoYanShou _model = new Catering_Model.YuanLiaoYanShou();
            Catering_Rules.YuanLiaoYanShou _rules = new Catering_Rules.YuanLiaoYanShou();
            try
            {
                var list = _rules.GetModelList(" ribaobianhao = '" + ribaobianhao + "'");
                if (list != null && list.Count > 0)
                {
                    _model = list.First();
                    _model.hege = Convert.ToBoolean(hege);
                    if (_rules.Update(_model))
                    {
                        return mes = "ok";
                    }
                }
            }
            catch
            {
            }
            return mes;
        }

        /// <summary>
        /// 编写：章建国
        /// </summary>
        /// <returns></returns>
        [System.Web.Services.WebMethod]
        public static string ld(string lingdao, string ribaobianhao)
        {
            string mes = "error";
            Catering_Model.YuanLiaoYanShou _model = new Catering_Model.YuanLiaoYanShou();
            Catering_Rules.YuanLiaoYanShou _rules = new Catering_Rules.YuanLiaoYanShou();
            try
            {
                var list = _rules.GetModelList(" ribaobianhao = '" + ribaobianhao + "'");
                if (list != null && list.Count > 0)
                {
                    _model = list.First();
                    _model.lingdao = Convert.ToBoolean(lingdao);
                    if (_rules.Update(_model))
                    {
                        return mes = "ok";
                    }
                }
            }
            catch
            {
            }
            return mes;
        }
        #endregion 原料验收
    }
}